home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / guile-ii.src / guile-ii / guile-src / libguile / simpos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-03  |  3.7 KB  |  155 lines

  1. /*    Copyright (C) 1995 Free Software Foundation, Inc.
  2.  * 
  3.  * This program is free software; you can redistribute it and/or modify
  4.  * it under the terms of the GNU General Public License as published by
  5.  * the Free Software Foundation; either version 2, or (at your option)
  6.  * any later version.
  7.  * 
  8.  * This program is distributed in the hope that it will be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  * GNU General Public License for more details.
  12.  * 
  13.  * You should have received a copy of the GNU General Public License
  14.  * along with this software; see the file COPYING.  If not, write to
  15.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  *
  17.  * As a special exception, the Free Software Foundation gives permission
  18.  * for additional uses of the text contained in its release of GUILE.
  19.  *
  20.  * The exception is that, if you link the GUILE library with other files
  21.  * to produce an executable, this does not by itself cause the
  22.  * resulting executable to be covered by the GNU General Public License.
  23.  * Your use of that executable is in no way restricted on account of
  24.  * linking the GUILE library code into it.
  25.  *
  26.  * This exception does not however invalidate any other reasons why
  27.  * the executable file might be covered by the GNU General Public License.
  28.  *
  29.  * This exception applies only to the code released by the
  30.  * Free Software Foundation under the name GUILE.  If you copy
  31.  * code from other Free Software Foundation releases into a copy of
  32.  * GUILE, as the General Public License permits, the exception does
  33.  * not apply to the code that you add in this way.  To avoid misleading
  34.  * anyone as to the status of such modified files, you must delete
  35.  * this exception notice from them.
  36.  *
  37.  * If you write modifications of your own for GUILE, it is your choice
  38.  * whether to permit this exception to apply to your modifications.
  39.  * If you do not wish that, delete this exception notice.  
  40.  */
  41.  
  42.  
  43. #include <stdio.h>
  44. #include "_scm.h"
  45.  
  46.  
  47.  
  48.  
  49. #ifndef _Windows
  50. PROC (s_system, "system", 1, 0, 0, scm_system);
  51. #ifdef __STDC__
  52. SCM
  53. scm_system(SCM cmd)
  54. #else
  55. SCM
  56. scm_system(cmd)
  57.      SCM cmd;
  58. #endif
  59. {
  60.   ASSERT(NIMP(cmd) && ROSTRINGP(cmd), cmd, ARG1, s_system);
  61.   scm_ignore_signals();
  62. # ifdef AZTEC_C
  63.   cmd = MAKINUM(Execute(CHARS(cmd), 0, 0));
  64. # else
  65.   cmd = MAKINUM(0L+system(CHARS(cmd)));
  66. # endif
  67.   scm_unignore_signals();
  68.   return cmd;
  69. }
  70. #endif
  71.  
  72. char *getenv();
  73. PROC (s_getenv, "getenv", 1, 0, 0, scm_getenv);
  74. #ifdef __STDC__
  75. SCM
  76. scm_getenv(SCM nam)
  77. #else
  78. SCM
  79. scm_getenv(nam)
  80.      SCM nam;
  81. #endif
  82. {
  83.   char *val;
  84.   ASSERT(NIMP(nam) && ROSTRINGP(nam), nam, ARG1, s_getenv);
  85.   val = getenv(CHARS(nam));
  86.   if (!val) return BOOL_F;
  87.   return scm_makfromstr(val, (sizet)strlen(val), 0);
  88. }
  89.  
  90. #ifdef vms
  91. # define SYSTNAME "VMS"
  92. #endif
  93. #ifdef unix
  94. # define SYSTNAME "UNIX"
  95. #endif
  96. #ifdef MWC
  97. # define SYSTNAME "COHERENT"
  98. #endif
  99. #ifdef _Windows
  100. # define SYSTNAME "WINDOWS"
  101. #else
  102. # ifdef MSDOS
  103. #  define SYSTNAME "MS-DOS"
  104. # endif
  105. #endif
  106. #ifdef __EMX__
  107. # define SYSTNAME "OS/2"
  108. #endif
  109. #ifdef __IBMC__
  110. # define SYSTNAME "OS/2"
  111. #endif
  112. #ifdef THINK_C
  113. # define SYSTNAME "THINKC"
  114. #endif
  115. #ifdef AMIGA
  116. # define SYSTNAME "AMIGA"
  117. #endif
  118. #ifdef atarist
  119. # define SYSTNAME "ATARIST"
  120. #endif
  121. #ifdef mach
  122. # define SYSTNAME "MACH"
  123. #endif
  124. #ifdef ARM_ULIB
  125. # define SYSTNAME "ACORN"
  126. #endif
  127.  
  128. PROC (s_software_type, "software-type", 0, 0, 0, scm_software_type);
  129. #ifdef __STDC__
  130. SCM
  131. scm_software_type(void)
  132. #else
  133. SCM
  134. scm_software_type()
  135. #endif
  136. {
  137. #ifdef nosve
  138.   return CAR(scm_intern("nosve", 5));
  139. #else
  140.   return CAR(scm_intern(SYSTNAME, sizeof SYSTNAME/sizeof(char) -1));
  141. #endif
  142. }
  143.  
  144. #ifdef __STDC__
  145. void
  146. scm_init_simpos (void)
  147. #else
  148. void
  149. scm_init_simpos ()
  150. #endif
  151. {
  152. #include "simpos.x"
  153. }
  154.  
  155.